import sys

from PyQt5.QAxContainer import QAxWidget
from PyQt5.QtCore import QEvent
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication, QMainWindow


class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        self.menuBar()

        self.centralwidget = QWidget(self)
        self.centralwidget_vlayout = QVBoxLayout(self.centralwidget)

        self.axwidget = QAxWidget(self.centralwidget)
        self.axwidget.installEventFilter(self)
        self.axwidget.setControl(r'D:\Manual\RUANJIAN\qq\qqdocument\861912251\FileRecv\21通2无言小组.pptx')

        self.pushbutton = QPushButton(self.centralwidget)
        self.pushbutton.setText("Press me!")

        self.centralwidget_vlayout.addWidget(self.axwidget)
        self.centralwidget_vlayout.addWidget(self.pushbutton)

        self.setCentralWidget(self.centralwidget)

        self.show()

    def eventFilter(self, widget: QWidget, event: QEvent):
        if event.type() == QEvent.Resize and widget is self.axwidget:
            self.axwidget.setFixedHeight(int(self.axwidget.width() / 16 * 9))

        return super(MainWindow, self).eventFilter(widget, event)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    mainWin = MainWindow()
    sys.exit(app.exec())